home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / Bonus / Plasmatech / ptscp_eval.exe / %MAINDIR% / Interface / UPTImageCombo.int < prev    next >
Encoding:
Text File  |  2001-08-31  |  8.0 KB  |  243 lines

  1. unit UPTImageCombo; // Copyright ⌐ 1996-2001 Plasmatech Software Design. All rights reserved.
  2. {
  3.  Shell Control Pack
  4.  Version 1.6
  5.  
  6.  History
  7.  ===================================================================================================
  8.  V1.6   2Jul01 Delphi 6 release, no changes.
  9.  V1.5c 30Mar01 No changes.
  10.  V1.5b 12Dec00 No changes.
  11.  V1.5a 14May00 No changes.
  12.  V1.5   3Mar00 C++Builder 5 release.
  13.                Added OnGetItemData event to TPTImageCombo which works like a 'virtual mode' for
  14.                  the combo item data.
  15.  V1.4a 15Dec99 Published OnContextPopup for Delphi 5.
  16.  V1.4  14Sep99 Minor changes to support Delphi 5.
  17.  V1.3h 29Mar99 Fixed problem where TPTImageCombo wouldn't draw its background using the Color
  18.                  property. It would always use clWindow.
  19.  V1.3g  1Dec98 No changes.
  20.  V1.3f 12Jul98 Minor changes to support Delphi 4.
  21.  V1.3e 22Apr98 No changes.
  22.  V1.3d 18Apr98 No changes.
  23.  V1.3c 16Mar98 Slight changes to method ordering in item destruction.
  24.  V1.3b  7Feb98 Added Index property to TPTImageComboItem.
  25.  V1.3a  7Jan98 No changes.
  26.  V1.3  28Nov97 Added AutoSizeHeight property to TPTCustomImageCombo.
  27.                Added WM_SETFONT handling for image combo. Image based combos now change height
  28.                  with different font sizes.
  29.                Added better design-time handling of change ItemHeight property.
  30.                Changed icon drawing in image combo - image is now centered vertically.
  31.                Fixed bug with TPTImageCombo which would cause AV's when no ImageList property
  32.                  was assigned.
  33.  V1.2b 12Oct97 No significant changes.
  34.  V1.2a  5Oct97 No changes.
  35.  V1.2   6Sep97 No changes.
  36.  V1.1a  6Jul97 No changes.
  37.  V1.1  26Jun97 Changes to OnDeleteItem.
  38.  V1.0c 31May97 No changes.
  39.  V1.0b 17May97 Delphi 3 support.
  40.  V1.0a  1May97 No changes.
  41.  V1.0  21Apr97 Released version 1.0
  42. }
  43.  
  44. {$INCLUDE PTCompVer.inc}
  45.  
  46. {$RANGECHECKS OFF} {$OVERFLOWCHECKS OFF} {$WRITEABLECONST OFF}
  47. {$BOOLEVAL OFF}    {$EXTENDEDSYNTAX ON}  {$TYPEDADDRESS ON}
  48.  
  49. interface
  50. uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  51. {$IFDEF VCL40PLUS}
  52.      ImgList,
  53. {$ENDIF}
  54.      StdCtrls;
  55.  
  56. { $DEFINE PTDEBUG} // <-- Define this symbol to turn on leak checking
  57.  
  58. type//-- Classes
  59.      TPTImageComboItem = class;
  60.  
  61.     //-- Components
  62.      TPTCombobox = class;
  63.      TPTCustomImageCombo = class;
  64.      TPTImageCombo = class;
  65.  
  66.  
  67.      TPTImageComboItem = class
  68.        protected
  69.          mOwner: TPTCustomImageCombo;
  70.          mItemIndex: Integer;
  71.  
  72.          mIndex: Integer;
  73.          mIndent: Integer;
  74.          mImageIndex: Integer;
  75.          mOverlayIndex: Integer;
  76.          mCaption: String;
  77.          mTag: Integer;
  78.          mData: Pointer;
  79.  
  80.          procedure SetIndent( aValue: Integer );
  81.          procedure SetImageIndex( aValue: Integer );
  82.          procedure SetCaption( const aValue: String );
  83.          procedure SetOverlayIndex( aValue: Integer );
  84.  
  85.        public
  86.          constructor Create( aOwner: TPTCustomImageCombo );
  87.          destructor  Destroy; override;
  88.  
  89.          property Index: Integer read mIndex; // Index in the list of the owning combobox
  90.          property Indent: Integer read mIndent write SetIndent;
  91.          property ImageIndex: Integer read mImageIndex write SetImageIndex;
  92.          property OverlayIndex: Integer read mOverlayIndex write SetOverlayIndex;
  93.          property Caption: String read mCaption write SetCaption;
  94.          property Data: Pointer read mData write mData;  // User defined information
  95.          property Tag: Integer read mTag write mTag;     // User defined information
  96.      end; {TPTImageComboItem}
  97.  
  98.  
  99.      TPTDeleteComboItemEvent = procedure( aSender: TObject;  aItem: Pointer ) of object;
  100.  
  101.      TPTCustomCombobox = class(TCustomCombobox)
  102.      end; {TPTCustomCombobox}
  103.  
  104.  
  105.      TPTCombobox = class(TPTCustomCombobox)
  106.        published
  107.         // -- Normal combobox properites
  108.          property Style; {Must be published before Items}
  109.          property Color;
  110.          property Ctl3D;
  111.          property DragMode;
  112.          property DragCursor;
  113.          property DropDownCount;
  114.          property Enabled;
  115.          property Font;
  116.          property ItemHeight;
  117.          property Items;
  118.          property MaxLength;
  119.          property ParentColor;
  120.          property ParentCtl3D;
  121.          property ParentFont;
  122.          property ParentShowHint;
  123.          property PopupMenu;
  124.          property ShowHint;
  125.          property Sorted;
  126.          property TabOrder;
  127.          property TabStop;
  128.          property Text;
  129.          property Visible;
  130.          property OnChange;
  131.          property OnClick;
  132.          property OnDblClick;
  133.          property OnDragDrop;
  134.          property OnDragOver;
  135.          property OnDrawItem;
  136.          property OnDropDown;
  137.          property OnEndDrag;
  138.          property OnEnter;
  139.          property OnExit;
  140.          property OnKeyDown;
  141.          property OnKeyPress;
  142.          property OnKeyUp;
  143.          property OnMeasureItem;
  144.          property OnStartDrag;
  145.         // -- Added by TPTCustomCombobox
  146.          property OnDeleteItem;
  147.          property OnCloseUp;
  148.          property OnSelEndCancel;
  149.          property OnSelEndOk;
  150. {$IFDEF VCL40PLUS}
  151.          property Anchors;
  152.          property Constraints;
  153.          property DragKind;
  154.          property ImeMode;
  155.          property ImeName;
  156.          property BiDiMode;
  157.          property ParentBiDiMode;
  158.          property OnEndDock;
  159.          property OnStartDock;
  160. {$ENDIF}
  161. {$IFDEF VCL50PLUS}
  162.          property OnContextPopup;
  163. {$ENDIF}
  164.      end; {TPTCombobox}
  165.  
  166.      TPTDeleteImageComboItemEvent = procedure( aSender: TObject;  aItem: TPTImageComboItem ) of object;
  167.      TPTImageComboGetItemDataEvent = procedure( aSender: TObject;  aItem: TPTImageComboItem ) of object;
  168.  
  169.      TPTCustomImageCombo = class(TPTCustomCombobox)
  170.        public
  171.          constructor Create( aOwner: TComponent ); override;
  172.          destructor  Destroy;  override;
  173.  
  174.          function  AddItem( aCaption: String;  aImageIndex: Integer;  aIndent: Integer ): TPTImageComboItem; {$IFDEF VCL60PLUS} reintroduce; {$ENDIF} virtual;
  175.          property  ImageComboItem[index: Integer]: TPTImageComboItem read GetImageComboItem;
  176.      end; {TPTCustomImageCombo}
  177.  
  178.  
  179.      TPTImageCombo = class(TPTCustomImageCombo)
  180.        published
  181.          property AutoSizeHeight;
  182.          property IndentPixels;
  183.          property ImageList;
  184.          property OnDeleteItem;
  185.          property OnCloseUp;
  186.          property OnSelEndCancel;
  187.          property OnSelEndOk;
  188.          property OnGetItemData;
  189.         // -- Normal combobox properties
  190.          property Color;
  191.          property Ctl3D;
  192.          property DragMode;
  193.          property DragCursor;
  194.          property DropDownCount;
  195.          property Enabled;
  196.          property Font;
  197.          property ItemHeight;
  198.          property MaxLength;
  199.          property ParentColor;
  200.          property ParentCtl3D;
  201.          property ParentFont;
  202.          property ParentShowHint;
  203.          property PopupMenu;
  204.          property ShowHint;
  205.          property Sorted;
  206.          property TabOrder;
  207.          property TabStop;
  208.          property Visible;
  209.          property OnChange;
  210.          property OnClick;
  211.          property OnDblClick;
  212.          property OnDragDrop;
  213.          property OnDragOver;
  214.          property OnDrawItem;
  215.          property OnDropDown;
  216.          property OnEndDrag;
  217.          property OnEnter;
  218.          property OnExit;
  219.          property OnKeyDown;
  220.          property OnKeyPress;
  221.          property OnKeyUp;
  222.          property OnMeasureItem;
  223.          property OnStartDrag;
  224. {$IFDEF VCL40PLUS}
  225.          property Anchors;
  226.          property Constraints;
  227.          property DragKind;
  228.          property ImeMode;
  229.          property ImeName;
  230.          property BiDiMode;
  231.          property ParentBiDiMode;
  232.          property OnEndDock;
  233.          property OnStartDock;
  234. {$ENDIF}
  235. {$IFDEF VCL50PLUS}
  236.          property OnContextPopup;
  237. {$ENDIF}
  238.      end; {TPTImageCombo}
  239.  
  240.  
  241. {*****************************************************************************}
  242. implementation
  243.